package com.mini.constant;

/**
 * 学员学习课程的方式：观看正常的课程 or 观看课程回放
 */
public enum StudentStudyType {
    COURSE_BROADCAST_ALL(0, "直播,点播"),
    COURSE_BROADCAST_LIVE(1, "直播"),
    COURSE_BROADCAST_REPLAY(2, "点播"),
    ;

    private int type;
    private String name;

    StudentStudyType(int type, String name) {
        this.type = type;
        this.name = name;
    }


    public static StudentStudyType getByType(Integer type){
        if(type == null){
            return null;
        }
        for(StudentStudyType sst : StudentStudyType.values()){
            if(sst.getType() == type){
                return sst;
            }
        }

        return null;
    }

    public static String getNameByType(Integer type){
        StudentStudyType sst = getByType(type);

        return sst == null ? null : sst.getName();
    }

    public int getType() {
        return type;
    }

    public String getName() {
        return name;
    }
}
